<?xml version="1.0" encoding="UTF-8"?>
<ui:composition
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
	template="/WEB-INF/templates/default.xhtml"
	xmlns:pe="http://primefaces.org/ui"
>

	<f:metadata>
		<f:viewParam
			name="bulletinId"
			value="#{bulletinHome3.id}"
		></f:viewParam>
		<f:event
			listener="#{bulletinHome3.initConversation()}"
			type="preRenderView"
		></f:event>
		<f:viewParam
			name="moduleName"
			value="评审选取结果审核"
		></f:viewParam>
	</f:metadata>
	<ui:define name="head">
		<style type="text/css">
		.removeButton {
			float: right;
			margin-right: 20px;
		}
		
		.limitUnit {
			margin-top: 5px;
		}
		.closeBtn {
				float: right;
				background: url(#{resource['images/close2.png']}) 0 0 no-repeat;
				height: 22px;
				width: 22px;
				margin: 5px 12px 0 0;
			}
			.closeBtn:hover {
				background: url(#{resource['images/close2_hover.png']}) 0 0 no-repeat;
			}
</style>
	</ui:define>
	<ui:define name="content">

		<h:form >
			<p:panel
				id="panel"
				header="评审选取公告信息"
				style="margin-bottom:10px;"
			>
				<p:messages id="messages" closable="true">
		       		<p:autoUpdate />
		       	</p:messages>
				<ui:include src="../template/include/bulletinInfo.xhtml" />
			</p:panel>
			<p:panel
				id="requalifations"
				header="资质要求"
				style="margin-bottom:10px;"
			>
				<ui:include src="../template/include/bulletinReqInfo.xhtml" />
			</p:panel>
			<p:panel header="相关附件">
				<ui:include
					src="/WEB-INF/templates/include/bulletinAttachments.xhtml"
				/>
			</p:panel>
			
			<p:selectOneRadio id="successTradeRadio" value="#{bulletinHome3.successTradeId}" layout="custom" required="true">
				<f:selectItems value="#{bulletinHome3.instance.verifiedTrades}" var="_trade" itemLabel="#{_trade.supplier.cnname}" itemValue="#{_trade.id}"></f:selectItems>
			</p:selectOneRadio>
			
			<p:panel header="备选中介">
				<p:dataTable value="#{bulletinHome3.instance.verifiedTrades}" var="_trade" rowIndexVar="_row">
					<p:column width="40" style="text-align: center;">
						<p:radioButton for="@form:successTradeRadio" itemIndex="#{_row}" />
					</p:column>
				
					<p:column headerText="序号" style="text-align: center;" width="30">
						<h:outputText value="#{_row + 1}" />
					</p:column>
					
					<p:column headerText="中介机构" width="300">
						<h:outputText value="#{_trade.supplier.cnname}" />
					</p:column>
					
					<p:column headerText="地址" width="480">
						<h:outputText value="#{_trade.supplier.address}" />
					</p:column>
					
					<p:column headerText="信用评级" style="text-align: center;">
						<h:outputText value="#{_trade.supplier.creditLevel.typeName}">
							<f:convertNumber maxFractionDigits="0"/>
						</h:outputText>
					</p:column>
					
					<p:column headerText="信用分">
						<p:outputPanel style="text-align: right">
							<h:outputText value="#{_trade.supplier.creditScore}">
								<f:convertNumber maxFractionDigits="0"/>
							</h:outputText>
						</p:outputPanel>
					</p:column>
				</p:dataTable>
			</p:panel>
			
			<p:panel header="评审结果公示">

				<h:panelGrid columns="2" cellpadding="5" width="600">
					<p:outputLabel for="imageUpload" value="图片材料" />			
					<p:outputPanel>
						<p:fileUpload
							id="imageUpload"
							mode="advanced"
							skinSimple="true"
							allowTypes="/(\.|\/)(jpe?g|png)$/"
							fileLimitMessage="只能上传一个附件"
							sizeLimit="#{1024 * 1024 * 5}"
							uploadLabel="上传"
							cancelLabel="取消" 
							update="@form:uploadedImages"
							fileUploadListener="#{bulletinHome3.assessChooseAuditUploadImage}"
						></p:fileUpload>
						<p:panel style="min-height:100px"
							 id="uploadedImages">
							<div id="imgsPreview"  style="display:inline-block">
								<p:repeat var="_image" value="#{bulletinHome3.instance.assessImages}" varStatus="_status">
									<img  data-original="#{attachmentUtils.getFullPath(_image)}" src="#{attachmentUtils.getFullPath(_image)}"  width="240"/>
								</p:repeat>
							</div>
						</p:panel>
					</p:outputPanel>	
					
					<p:outputLabel for="attachmentUploadFile" value="附件材料" />		
					<p:outputPanel>
						<p:fileUpload
							id="attachmentUploadFile"
							label="选择"
							mode="advanced"
							multiple="true"
							skinSimple="true"
							sizeLimit="#{1024 * 1024 * 3}"
							uploadLabel="上传"
							cancelLabel="取消"
							update="@form:uploadedAttachments"
							fileUploadListener="#{bulletinHome3.assessChooseAuditUploadAttachments}"
						/>
						<p:panel id="uploadedAttachments">
							<ul>
								<p:repeat var="_attr" value="#{bulletinHome3.instance.assessAttachments}" varStatus="_status">
									<li>
										<p:link value="#{_status.index + 1}、#{_attr.filename}" target="_blank" ajax="false" href="#{attachmentUtils.getFullPath(_attr)}" />、											
										<span>
											<p:commandLink styleClass="closeBtn" action="#{assessRecordHome.removeAttachment(_status.index)}" update="@form:uploadedAttachments" immediate="true"  ></p:commandLink>															
										</span>
									</li>
								</p:repeat>
							</ul>
						</p:panel>
					</p:outputPanel>	
				</h:panelGrid>
			</p:panel>
			
			<p:panel>
				<h:inputHidden value="#{bulletinHome3.instance.id}" />

				<p:button
					href="#{request.contextPath}/rest/bulletin/export/assessCandidateList/#{bulletinHome3.instance.id}"
					value="导出报名中介名单"
					rendered="#{bulletinHome3.instance.hasAppliedCount > 0}">
				</p:button>

				<ui:remove>
					<p:commandButton
						widgetVar="showManual"
						oncomplete="PF('chooseSuplierDialog').show();"
						value="选择中介"
						update="chooseSuplierDialog"
					/>
				</ui:remove>
				<p:commandButton
					value="发布评审结果"
					action="#{bulletinHome3.auditAssessChoose()}">
				
				</p:commandButton>
				<p:commandButton
					action="#{bulletinHome3.cancel()}"
					value="取消"
					immediate="true"
				></p:commandButton>
			</p:panel>
		</h:form>		

	</ui:define>
</ui:composition>
